home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-26 | 2.7 KB | 172 lines | [TEXT/MMCC] |
-
-
- #include "SortPicts.h"
-
- /*
- * Constructor
- * -----------
- *
- * Call CreateWindow to make the new window.
- */
- SortPicts::SortPicts()
- {
- CreateWindow(kNormalWindow);
- }
-
-
- /*
- * Destructor
- * ----------
- *
- * Beavis says, "Uh, uhhh, hhuhh, don't dispose memory ... thats cool."
- */
- SortPicts::~SortPicts()
- {
- }
-
-
-
-
- /*
- * MakeNewWindow
- * -------------
- *
- * This routine will create a GWorld with a given name.
- * In theory, the name would be passed around some how
- * (I stress the somehow ...) so that various windows
- * could be used.
- *
- * Notice the MakeThread call. That is not a direct call
- * to the ThreadManager. Go look at the routine to see
- * how it works. (This is a "well de-composed" program.)
- */
- WindowPtr
- SortPicts::MakeNewWindow(WindowPtr behindWindow)
- {
- if( PrepareGWorld( "\pApple, IBM, Motorola"))
- {
- me = GetNewCWindow(128,nil,behindWindow);
- if( me)
- {
- SetWTitle( me, "\pApple, IBM, Motorola");
- SizeWindow( me, pictWidth, windPictRect.bottom, false);
- ShowWindow( me);
-
- MakeThreaded();
- }
-
-
- }
-
- return me;
- }
-
-
- void
- SortPicts::Activate(Boolean /* activating */)
- {
- // DrawGrowIcon(fWindow);
- }
-
-
- void
- SortPicts::AdjustCursor(EventRecord * /* anEvent */)
- {
- }
-
-
- /*
- * Draw
- * ----
- *
- * Do your basic stuff.
- */
- void
- SortPicts::Draw(void)
- {
- return;
- sortPixmap = GetGWorldPixMap( sortGWorld);
-
- LockPixels( sortPixmap);
-
- CopyBits( (const BitMap *) *sortPixmap,
- (const BitMap *) (*(((CWindowPtr)me)->portPixMap)),
- &sortRect,&windPictRect,srcCopy,nil);
-
- UnlockPixels( sortPixmap);
- }
-
-
- void
- SortPicts::KeyDown(EventRecord * /* anEvent */ )
- {
- this->Select();
- }
-
-
- void
- SortPicts::AdjustForNewWindowSize(Rect * /* oldSize */, Rect * /* newSize */)
- {
- // DrawGrowIcon(fWindow);
- }
-
-
- /*
- * Close
- * -----
- *
- * The key here is ... DisposeThread.
- */
- Boolean
- SortPicts::Close(void)
- {
- StandardCloseResult result;
- Str255 title;
-
- GetWTitle(this->fWindow,title);
- result = StandardCloseDocument(LMGetCurApName(),title,false,false);
-
- if (result != kCancelSaveDocument)
- {
- DisposeThread( threadInfo, nil, true);
- return TWindow::Close();
- }
- return false;
- }
-
-
- OSErr
- SortPicts::HandleDrag(DragTrackingMessage dragMessage,DragReference theDrag)
- {
- RgnHandle hiliteRgn = NewRgn();
-
- switch (dragMessage)
- {
- case dragTrackingEnterWindow:
- SetRectRgn( hiliteRgn,
- fWindow->portRect.left,
- fWindow->portRect.top,
- fWindow->portRect.right,
- fWindow->portRect.bottom);
- ShowDragHilite(theDrag,hiliteRgn,true);
- break;
-
- case dragTrackingLeaveWindow:
- HideDragHilite(theDrag);
- break;
-
- default:
- break;
- }
-
- DisposeRgn(hiliteRgn);
- return(noErr);
- }
-
-
- OSErr
- SortPicts::HandleDrop(DragReference /* theDrag */)
- {
- return(noErr);
- }
-